package com.tianzhu.config;

import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.HiddenHttpMethodFilter;

@Configuration
public class FilterConfig {
	
	@Bean
	public FilterRegistrationBean someFilterRegistration() {

	    FilterRegistrationBean registration = new FilterRegistrationBean();
	    registration.setFilter(someFilter());
	    registration.addUrlPatterns("/**");
	    //registration.addInitParameter("paramName", "paramValue");
	    registration.setName("httpMethodFilter");
	    //registration.setOrder(1);
	    return registration;
	} 

	@Bean(name = "httpMethodFilter")
	public HiddenHttpMethodFilter someFilter() {
	    return new HiddenHttpMethodFilter();
	}
}
